<?php

use App\Http\Controllers\AuthController;
use App\Http\Controllers\IndexController;
use App\Http\Controllers\PaymentController;
use Illuminate\Support\Facades\Route;

Route::get('/', [IndexController::class, 'index']);

/**
 * 微信用户鉴权，获取openid,nickname,avatar信息，并返回JWToken
 */
Route::domain(config('custom.auth_domain'))
    ->get('auth/wechat/token', [AuthController::class, 'index'])
    ->name('auth.wechat.token');
Route::domain(config('custom.auth_domain'))
    ->get('auth/wechat/token/callback', [AuthController::class, 'callback'])
    ->name('auth.wechat.token.callback');

/**
 * 发起微信支付
 */
Route::domain(config('custom.payment_domain'))
    ->get('payment/wechat', [PaymentController::class, 'wechat'])
    ->name('payments.wechat');

Route::get('MP_verify_{code}.txt', function ($code) {
    return $code;
});

